﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FJASPX.Service;
using NHibernate.Criterion;
using FJASPX.Framwork.Helper;
using FJASPX.Framwork.Constant;
namespace PlugNT.Cms.Web.Home.Control
{
    public partial class Left : System.Web.UI.UserControl
    {
        public IUserService iUserService { get; set; }

        public IEnterpriseService iEnterpriseService { get; set; }

        public FJASPX.Domain.User user;

        public FJASPX.Domain.Enterprise enterprise;

        public IProductClassService iProductClassService { get; set; }

        private void Filter()
        {
            user = iUserService.Get(Request.QueryString["User"].ToInt());
            enterprise = iEnterpriseService.GetByUser(user);
            if (enterprise == null)
            {
                enterprise = new FJASPX.Domain.Enterprise();
                enterprise.Name = user.CompanyName;
                enterprise.Contant = user.RealName;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Filter();
            }
        }
        public IList<FJASPX.Domain.ProductClass> GetProductClass()
        {
            long totalCount = 0;
            ICriterion criterion = null;// Expression.Eq("UserName", Request.QueryString["User"]);
            List<Order> orders = new List<Order>();
            orders.Add(new Order("TimeStamp", false));
            return iProductClassService.PagedQuery(criterion, orders, 0, 20, out totalCount);
        }
    }
}